package com.huazhi.wzsnw.service.impl;

import com.huazhi.wzsnw.mapper.PositionMapper;
import com.huazhi.wzsnw.model.Position;
import com.huazhi.wzsnw.service.PositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PositionServiceImpl implements PositionService {
    @Autowired
    private PositionMapper positionMapper;

    @Override
    public int save(Position record) {
        return positionMapper.insertSelective(record);
    }

    @Override
    public int delete(Position record) {
        record.setState("0");
        positionMapper.updateByPrimaryKeySelective(record);
        return 0;
    }

    @Override
    public int deletes(List<Position> records) {
        return 0;
    }

    @Override
    public int update(Position record) {
        return positionMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public Position findByTid(String tid) {
        return positionMapper.selectByPrimaryKey(tid);
    }

    @Override
    public List<Position> findPagingByListTid(List<String> stringList, Integer pageIndex, Integer pageSize) {
        return positionMapper.findPagingByListTid(stringList,pageIndex,pageSize);
    }

    @Override
    public List<String> getListTidBySearch(String key) {
        return positionMapper.selectListTidBySearch(key);
    }

    @Override
    public Position getPositionByField(String positionname) {
        return positionMapper.selectPositionByField(positionname);
    }

    @Override
    public Position getPositionByFieldByNOTID(String tid, String positionname) {
        return positionMapper.selectPositionByFieldByNOTID(tid,positionname);
    }

    @Override
    public List<Position> getList() {
        return positionMapper.selectListPosition();
    }
}
